#include <stdio.h>
#include <unistd.h>
#include "hello.c"

int g_val = 100;
int main()
{
    printf("hello\n");
    pid_t ret = fork();
    if(ret<0){
        perror("fork");
        return;
    }else if(ret==0){
        while(1){
            printf("i am child pid=[%d],ppid=[%d]\n",getpid(),getppid());
            g_val -=50;
            printf("child ,g_val:%d\n",g_val);
            print();
            sleep(20);
        }
    }else if(ret>0){
        while(1){
            printf("i am father pid=[%d],ppid=[%d]\n",getpid(),getppid());
            g_val +=50;
            printf("father,g_val:%d\n",g_val);
            sleep(1);
        }
    }
    return 0;
}